import { Link, Warning } from '@brillout/docpress'

Vike doesn't include built-in support for [API routes](https://nextjs.org/docs/api-routes/introduction) by design.

> We believe API tools <Link href="/why#flourishing-do-one-thing-do-it-well-ecosystem">should be developed independently</Link> of Vike.

> See <Link href="/data-fetching" /> for a general introduction about fetching data with Vike.

We generally recommend using [Telefunc](https://telefunc.com) (or another RPC tool) instead of API routes, see <Link href="/RPC" />.

That said, creating API routes can make sense:
- For specific needs where Telefunc doesn't fit, such as file uploads or fine-grained HTTP cache control.
- If you only need a handful of endpoints, creating a couple of API routes can be simpler than adding a new tool to your stack.

To achieve a similar DX as API routes, you can use a server like [Express.js](https://expressjs.com) or [Hono](https://hono.dev) to create server routes that handle HTTP `GET`/`POST` endpoints.

>  Make sure <Link href="/renderPage">Vike's middleware</Link> is your last middleware. (It's a catch-all middleware so it would override your API routes.)

>  If you don't use <Link href="/vike-photon">`vike-photon`</Link>, then you may need to manually restart your server for changes to take effect.


## See also

- <Link href="/RPC" />
- <Link href="/data-fetching" />
- <Link href="/server-integration" />
